package com.yy.module.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import com.yy.base.common.entity.BaseEntity;

/**
 * 字段表
 */
@Entity
@Table(name="t_field")
public class Field extends BaseEntity {
	public static final String STRING = "string";
	public static final String INT = "int";
	public static final String FLOAT = "float";
	public static final String DATE = "date";
	
	private String id;
	private String tableId;//表ID
	private String name;//字段名
	private String text;//字段说明
	private String typeId;//字段类型
	private Integer isId = 0;//是否是主键，1：是，0：否
	private Integer isOnly = 0;//是否是唯一键，1：是，0：否
	private Integer isOrder;//是否是排序字段，1：是，0：否
	private Integer isNotNull = 0;//是否不能为空，1：是，0：否
	
	private Integer length;//长度
	private Integer fixed;//小数点保留位数
	private String remark;//备注
	
	@Id
	@Column(name="ID", length = 32, nullable = false)
    @GeneratedValue(generator = "uuid2" )//指定生成器名称
    @GenericGenerator(name = "uuid2", strategy = "org.hibernate.id.UUIDGenerator" )
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getTableId() {
		return tableId;
	}
	public void setTableId(String tableId) {
		this.tableId = tableId;
	}
	public String getName() {
		return name != null ? name.toUpperCase() : name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getText() {
		return text;
	}
	public void setText(String text) {
		this.text = text;
	}
	public String getTypeId() {
		return typeId;
	}
	public void setTypeId(String typeId) {
		this.typeId = typeId;
	}
	public Integer getIsNotNull() {
		return isNotNull;
	}
	public void setIsNotNull(Integer isNotNull) {
		this.isNotNull = isNotNull;
	}
	public Integer getIsId() {
		return isId;
	}
	public void setIsId(Integer isId) {
		this.isId = isId;
	}
	public Integer getIsOnly() {
		return isOnly;
	}
	public void setIsOnly(Integer isOnly) {
		this.isOnly = isOnly;
	}
	public Integer getIsOrder() {
		return isOrder;
	}
	public void setIsOrder(Integer isOrder) {
		this.isOrder = isOrder;
	}
	public Integer getLength() {
		return length;
	}
	public void setLength(Integer length) {
		this.length = length;
	}
	public Integer getFixed() {
		return fixed;
	}
	public void setFixed(Integer fixed) {
		this.fixed = fixed;
	}
	public String getRemark() {
		return remark;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
}